package Data_Structure.Tree.SearchTree;

import java.util.Scanner;

/**
 * @className: Test
 * @author: 芃
 * @description: 二叉搜索树测试类
 * @date: 2023/8/24 19:34
 */
//二叉搜索树概念及定义
//二叉搜索树，顾名思义，主要用于搜索，且查询效率极高（当然没有map高）
//若它的左子树不为空，则左子树上所有节点的值均小于根节点的值
//若它的右子树不为空，则右子树上所有节点的值均大于根节点的值
//root根节点的左右子树也分别是一棵二叉搜索树

//时间复杂度分析：
//最优情况下，二叉搜索树为完全二叉树，其时间复杂度为O(log2N)
//最差情况下，二叉搜索树是一棵单分支的树，其时间复杂度为O(N)
public class Test {
    public static void main(String[] args) {
        SearchTree searchTree = new SearchTree();
        searchTree.insert(17);
        searchTree.insert(88);
        searchTree.insert(68);
        searchTree.insert(34);
        searchTree.insert(71);
        searchTree.insert(34);
        searchTree.insert(58);
        searchTree.insert(61);
        searchTree.insert(76);
        searchTree.insert(6);
        searchTree.insert(76);
        searchTree.inOrder(searchTree.root);
        searchTree.remove(17);
        System.out.println();
        searchTree.inOrder(searchTree.root);

    }
}

